using System;
using System.Globalization;
using System.Windows.Data;

namespace PCR.Converter
{
	public class IntTwoConverter : IValueConverter
	{
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			int result = 0;
			int.TryParse(value.ToString(), out result);
			if (result < 10)
			{
				return "0" + result;
			}
			return result;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			int result = 0;
			int.TryParse(value.ToString(), out result);
			return result;
		}
	}
}
